<?php
$conn = mysql_connect('127.0.0.1', 'root', 'we3727021');
mysql_select_db('mall');
$query = mysql_query("SHOW FULL COLUMNS FROM mall_attr", $conn);
$content = array();
while($row = mysql_fetch_row($query))
{
    $row[1] = preg_replace('/\s+/', ',', $row[1]);
    $tmp = explode(',', $row[1]);
    $content[$row[0]]['type'] = $tmp[0];
    $content[$row[0]]['attr'] = isset($tmp[1]) ? $tmp[1] : '';
    $content[$row[0]]['is_null'] = $row[3];
    $content[$row[0]]['default'] = $row[5];
    $content[$row[0]]['is_pri'] = $row[4];
    $content[$row[0]]['extra'] = $row[6];
    $content[$row[0]]['zs'] = $row[8];
}

